public class MaxArea {
    // 盛水最多的容器
    // https://www.nowcoder.com/practice/3d8d6a8e516e4633a2244d2934e5aa47?tpId=295&tags=&title=&difficulty=0&judgeStatus=0&rp=0&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3D%25E7%25AE%2597%25E6%25B3%2595%25E7%25AF%2587%26topicId%3D295
    public int maxArea (int[] height) {
        // write code here
        int left = 0;
        int right = height.length-1;
        int maxValue = 0;
        while (left < right) {
            maxValue = Math.max(maxValue, Math.min(height[left], height[right]) * (right-left));
            if (height[left] < height[right]) {
                left++;
            } else {
                right--;
            }
        }
        return maxValue;
    }
}
